# -------------------关公战秦琼3.0---------------------

import random

hp_1 = 100  # 关公
hp_2 = 100  # 秦琼
i = 1  # 回合

print("关公对秦琼使用了决斗！")
while hp_1 > 0 and hp_2 > 0:
    print(f"--------------第{i}回合--------------")
    print(f"关公耐力{hp_1}")
    print(f"秦琼耐力{hp_2}")
    player = int(input("请选择武技： 1：劈砍 2：招架 3：突刺   "))
    # player = random.randint(1, 4)
    player2 = random.randint(1, 4)
    if player == 1 and player2 == 3:
        print("关公这回合占了上风！！")
        player_1 = random.randint(10, 33)
        player_2 = 10
        hp_2 = hp_2 - player_1
        hp_1 = hp_1 - player_2
        if player == 3:
            print("关公使用了突刺")
        elif player == 2:
            print("关公使用了招架")
        else:
            print("关公使用了劈砍")

        if player2 == 3:
            print("秦琼使用了突刺")
        elif player2 == 2:
            print("秦琼使用了招架")
        else:
            print("秦琼使用了劈砍")
        print(f"秦琼对关公造成了{player_2}点伤害，关公还有{hp_1}点耐力")
        print(f"关公对秦琼造成了{player_1}点伤害，秦琼还有{hp_2}点耐力")
    elif player == 2 and player2 == 1:
        print("关公这回合占了上风！！")
        player_1 = random.randint(5, 16)
        player_2 = 5
        hp_2 = hp_2 - player_1
        hp_1 = hp_1 - player_2
        if player == 3:
            print("关公使用了突刺")
        elif player == 2:
            print("关公使用了招架")
        else:
            print("关公使用了劈砍")

        if player2 == 3:
            print("秦琼使用了突刺")
        elif player2 == 2:
            print("秦琼使用了招架")
        else:
            print("秦琼使用了劈砍")
            print(f"秦琼对关公造成了{player_2}点伤害，关公还有{hp_1}点耐力")
            print(f"关公对秦琼造成了{player_1}点伤害，秦琼还有{hp_2}点耐力")
    elif player == 3 and player2 == 2:
        print("关公这回合占了上风！！")
        player_1 = random.randint(15, 48)
        player_2 = 15
        hp_2 = hp_2 - player_1
        hp_1 = hp_1 - player_2
        if player == 3:
            print("关公使用了突刺")
        elif player == 2:
            print("关公使用了招架")
        else:
            print("关公使用了劈砍")

        if player2 == 3:
            print("秦琼使用了突刺")
        elif player2 == 2:
            print("秦琼使用了招架")
        else:
            print("秦琼使用了劈砍")
        print(f"秦琼对关公造成了{player_2}点伤害，关公还有{hp_1}点耐力")
        print(f"关公对秦琼造成了{player_1}点伤害，秦琼还有{hp_2}点耐力")
    elif player ==3 and player2 == 3:
        print("这回合不分胜负！！")
        player_1 = 15
        player_2 = 15
        if player == 3:
            print("关公使用了突刺")
        elif player == 2:
            print("关公使用了招架")
        else:
            print("关公使用了劈砍")

        if player2 == 3:
            print("秦琼使用了突刺")
        elif player2 == 2:
            print("秦琼使用了招架")
        else:
            print("秦琼使用了劈砍")
        hp_2 = hp_2 - player_1
        hp_1 = hp_1 - player_2
        print(f"秦琼对关公造成了{player_2}点伤害，关公还有{hp_1}点耐力")
        print(f"关公对秦琼造成了{player_1}点伤害，秦琼还有{hp_2}点耐力")
    elif player == 1 and player2 == 1:
        print("这回合不分胜负！！")
        player_1 = 10
        player_2 = 10
        if player == 3:
            print("关公使用了突刺")
        elif player == 2:
            print("关公使用了招架")
        else:
            print("关公使用了劈砍")

        if player2 == 3:
            print("秦琼使用了突刺")
        elif player2 == 2:
            print("秦琼使用了招架")
        else:
            print("秦琼使用了劈砍")
        hp_2 = hp_2 - player_1
        hp_1 = hp_1 - player_2
        print(f"秦琼对关公造成了{player_2}点伤害，关公还有{hp_1}点耐力")
        print(f"关公对秦琼造成了{player_1}点伤害，秦琼还有{hp_2}点耐力")
    elif player == 2 and player2 == 2:
        print("这回合不分胜负！！")
        player_1 = 5
        player_2 = 5
        if player == 3:
            print("关公使用了突刺")
        elif player == 2:
            print("关公使用了招架")
        else:
            print("关公使用了劈砍")

        if player2 == 3:
            print("秦琼使用了突刺")
        elif player2 == 2:
            print("秦琼使用了招架")
        else:
            print("秦琼使用了劈砍")
        hp_2 = hp_2 - player_1
        hp_1 = hp_1 - player_2
        print(f"秦琼对关公造成了{player_2}点伤害，关公还有{hp_1}点耐力")
        print(f"关公对秦琼造成了{player_1}点伤害，秦琼还有{hp_2}点耐力")
    elif player2 == 1 and player == 3:
        print("秦琼这回合占了上风！！")
        player_2 = random.randint(10, 33)
        player_1 = 10
        hp_2 = hp_2 - player_1
        hp_1 = hp_1 - player_2
        if player == 3:
            print("关公使用了突刺")
        elif player == 2:
            print("关公使用了招架")
        else:
            print("关公使用了劈砍")

        if player2 == 3:
            print("秦琼使用了突刺")
        elif player2 == 2:
            print("秦琼使用了招架")
        else:
            print("秦琼使用了劈砍")
        print(f"秦琼对关公造成了{player_2}点伤害，关公还有{hp_1}点耐力")
        print(f"关公对秦琼造成了{player_1}点伤害，秦琼还有{hp_2}点耐力")
    elif player2 == 2 and player == 1:
        print("秦琼这回合占了上风！！")
        player_2 = random.randint(5, 16)
        player_1 = 5
        hp_2 = hp_2 - player_1
        hp_1 = hp_1 - player_2
        if player == 3:
            print("关公使用了突刺")
        elif player == 2:
            print("关公使用了招架")
        else:
            print("关公使用了劈砍")

        if player2 == 3:
            print("秦琼使用了突刺")
        elif player2 == 2:
            print("秦琼使用了招架")
        else:
            print("秦琼使用了劈砍")
        print(f"秦琼对关公造成了{player_2}点伤害，关公还有{hp_1}点耐力")
        print(f"关公对秦琼造成了{player_1}点伤害，秦琼还有{hp_2}点耐力")
    elif player2 == 3 and player == 2:
        print("秦琼这回合占了上风！！")
        player_2 = random.randint(15, 48)
        player_1 = 15
        hp_2 = hp_2 - player_1
        hp_1 = hp_1 - player_2
        if player == 3:
            print("关公使用了突刺")
        elif player == 2:
            print("关公使用了招架")
        else:
            print("关公使用了劈砍")

        if player2 == 3:
            print("秦琼使用了突刺")
        elif player2 == 2:
            print("秦琼使用了招架")
        else:
            print("秦琼使用了劈砍")
        print(f"秦琼对关公造成了{player_2}点伤害，关公还有{hp_1}点耐力")
        print(f"关公对秦琼造成了{player_1}点伤害，秦琼还有{hp_2}点耐力")
    else:
        print("双方周旋")
        print(f"关公还有{hp_1}点耐力")
        print(f"秦琼还有{hp_2}点耐力")
    i = i + 1

print("\n")
if hp_1 > 0 and hp_1 > hp_2:
    print("--------------关公胜利--------------")
elif hp_1 <= 0 and hp_2 <= 0:
    print("--------------鸣金收兵--------------")
else :
    print("--------------秦琼胜利--------------")

